//
//  ViewController.m
//  10503文本替换
//
//  Created by student on 16/2/21.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField1;
@property (weak, nonatomic) IBOutlet UITextField *textField2;
@property (weak, nonatomic) IBOutlet UITextView *textView1;
@property (weak, nonatomic) IBOutlet UITextView *textView2;

@property (weak, nonatomic) IBOutlet UITextField *textField3;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)tapBack:(id)sender {
    [self.view endEditing:YES];
}
- (IBAction)btnPressed:(UIButton *)sender {
//    NSLog(@"%lu,%lu",(unsigned long)range1.location,(unsigned long)range1.length);
    NSString *str1=[NSString stringWithString:self.textField1.text];
    NSString *str2=self.textField2.text;
    NSString *str3=self.textField3.text;
    NSMutableString *str=[NSMutableString stringWithFormat:@"%@",self.textView1.text];
    NSRange range1=[str rangeOfString:@"<name>"];
    [str replaceCharactersInRange:range1 withString:str1];
     NSRange range2=[str rangeOfString:@"<age>"];
    [str replaceCharactersInRange:range2 withString:str2];
   NSRange range3=[str rangeOfString:@"<class>"];
    [str replaceCharactersInRange:range3 withString:str3];
    self.textView2.text=str;
}

@end
